package com.yzh.design.demo;

/**
 * 双重锁校验（线程安全）
 */
public class Singleton_05 {
    private volatile static Singleton_05 instance;

    private Singleton_05() {
    }

    public Singleton_05 getInstance() {
        if (instance != null) return instance;
        synchronized (this) {
            if (instance == null) {
                instance = new Singleton_05();
            }
        }
        return instance;
    }
}
